/**
 * Escapes a string for insertion into HTML.
 */
export function escapeHtml(str: string): string {
  str = (str || '').toString()
    .replace(/&/g, '&amp;')
    .replace(/</g, '&lt;')
    .replace(/>/g, '&gt;')
    .replace(/'/g, '&#39;')
    .replace(/"/g, '&quot;')
  return str
}
